import Mock from 'mockjs';
const count = 100;

let memberTableList = [];
let serviceOrderList = [];
let ticketingOrderList = [];// 票务订单信息
for (let i = 0; i < count; i++) { // 模拟数据
    memberTableList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        orderNo: 'ORDER000000' + i,
        relevanceNo: 'RN000000' + i,
        customer: '@cname',
        storeName: '名称' + i,
        'xfMoney|1': ['120.00', '1213.00', '4123.00', '23.00'],
        'address': '@city',
        'isFenxiao|1': ['是', '否'],
        'TSstyle': '订单投诉',
        'Dstate|1': ['待平台处理', '待审核', '退款中', '售后成功', '售后关闭'],
        'Cstate|1': ['待处理', '待商家处理', '已驳回', '已完成', '已关闭'],
        'createOpeTime': '@date(yyyy-MM-dd HH:mm:ss)',
        'money|123.1-3': 1,
        'type|1': ['微信', '支付宝', '银联'],
        'orderType': '到店服务',
        'term': '1年',
        'goodsName': '抽奖大转盘活动',
        'state': '已完成',
        'num': '1',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'confirm'
                }, {
                    name: 'edit',
                    label: '处理'

                }
            ]
        ]
    }))
    serviceOrderList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        orderNo: 'ORDER000000' + i,
        relevanceNo: 'RN000000' + i,
        customer: '@cname',
        storeName: '名称' + i,
        'xfMoney|1': ['120.00', '1213.00', '4123.00', '23.00'],
        'address': '@city',
        'isFenxiao|1': ['是', '否'],
        'TSstyle': '订单投诉',
        'Dstate|1': ['待平台处理', '待审核', '退款中', '售后成功', '售后关闭'],
        'Cstate|1': ['待处理', '待商家处理', '已驳回', '已完成', '已关闭'],
        'createOpeTime': '@date(yyyy-MM-dd HH:mm:ss)',
        'money|123.1-3': 1,
        'type|1': ['微信', '支付宝', '银联'],
        'orderType': '到店服务',
        'term': '1年',
        'goodsName': '抽奖大转盘活动',
        'state': '已完成',
        'num': '1',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))
    ticketingOrderList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderNo': 'ORDER000000' + i,
        'info': '@date(yyyy年MM月dd日)' + '北京-济南 海航 HU7585' + i,
        'name': '@cname',
        'createOpeTime': '@date(yyyy-MM-dd HH:mm:ss)',
        'money|123.1-3': 1,
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))
}

export default [
    {
        path: '/api/getB2cStoreList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...serviceOrderList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/delMemberInfo',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                return {
                    code: 0,
                    msg: '删除数据成功',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getOrderInfo',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < memberTableList.length; i++) {
                    if (Number(body.uuid) === memberTableList[i].uuid) {
                        memberInfo = memberTableList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/addOrderInfo',
        method: 'get',
        handle ({ body }) {
            if (body.userName) {
                memberTableList.unshift(body.formData);
                return {
                    code: 0,
                    msg: '',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getTicketingOrderList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...ticketingOrderList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getTicketingOrder',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < ticketingOrderList.length; i++) {
                    if (Number(body.uuid) === ticketingOrderList[i].uuid) {
                        memberInfo = ticketingOrderList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/addTicketingOrder',
        method: 'get',
        handle ({ body }) {
            if (body.userName) {
                ticketingOrderList.unshift(body.formData);
                return {
                    code: 0,
                    msg: '',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/drawbackList',
        method: 'get',
        handle ({ body }) {
            let memberInfo = {};
            for (let i = 0; i < memberTableList.length; i++) {
                if (Number(body.uuid) === memberTableList[i].uuid) {
                    memberInfo = memberTableList[i];
                    break;
                }
            }
            return {
                code: 0,
                msg: '',
                data: {
                    data: memberInfo,
                    return_code: 0
                }
            }
        }
    }, {
        path: '/api/getLeaseOrderDetail',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < serviceOrderList.length; i++) {
                    if (Number(body.uuid) === serviceOrderList[i].uuid) {
                        memberInfo = serviceOrderList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getMarketingCampaignOrderDetail',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < serviceOrderList.length; i++) {
                    if (Number(body.uuid) === serviceOrderList[i].uuid) {
                        memberInfo = serviceOrderList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getOrderViewContent',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < serviceOrderList.length; i++) {
                    if (Number(body.uuid) === serviceOrderList[i].uuid) {
                        memberInfo = serviceOrderList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getThirdServicesOrderDetail',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < serviceOrderList.length; i++) {
                    if (Number(body.uuid) === serviceOrderList[i].uuid) {
                        memberInfo = serviceOrderList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }

]
